package com.itelite.service.impl;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author 沈洋 邮箱:1845973183@qq.com
 * @create 2021/8/29-17:05
 **/
@Service
@Slf4j
public class SchedulerServiceImpl {
    @Autowired
    private JavaMailSender javaMailSender;
    @Async
    public void sendEmail(SimpleMailMessage message) {

        try {
            javaMailSender.send(message);
        } catch (MailException e) {
            log.info("邮件发送失败");
            e.printStackTrace();
        }
    }

}
